###TABLES###

load("data_combined.RData")
load("uk.RData")


### Table 2
model1<-lm_robust(attitudes_scale~tr_interview+ tr_platform+wave, data=data_combined)
summary(model1)
model1_adj<-lm_robust(attitudes_scale~tr_interview+ tr_platform+wave+ factor(region) + factor(sex) + factor(education) + attitudes_pre_scale + age_num + factor(party), data=data_combined)
summary(model1_adj)

model2<-lm_robust(attitudes_scale~tr_interview*tr_platform+wave, data=data_combined)
summary(model2)
model2_adj<-lm_robust(attitudes_scale~tr_interview*tr_platform+wave+ factor(region) + factor(sex) + factor(education) + attitudes_pre_scale + age_num + factor(party), data=data_combined)
summary(model2_adj)

model3<-lm_robust(attitudes_scale~factor(tr_cat)+tr_platform, data=uk)
summary(model3)
model3_adj<-lm_robust(attitudes_scale~factor(tr_cat)+tr_platform+ factor(region) + factor(sex) + factor(education) + attitudes_pre_scale + age_num + factor(party) + factor (brexit), data=uk)
summary(model3_adj)

model4<-lm_robust(attitudes_scale~factor(tr_cat)*tr_platform, data=uk)
summary(model3)
model4_adj<-lm_robust(attitudes_scale~factor(tr_cat)*tr_platform+ factor(region) + factor(sex) + factor(education) + attitudes_pre_scale + age_num + factor(party) + factor (brexit), data=uk)
summary(model4_adj)

texreg(list(model1, model1_adj, model2, model2_adj,model3, model3_adj, model4, model4_adj), include.ci = FALSE, stars=c(0.001, 0.01, 0.05), caption="Anti-immigration attitudes")


## Table 3
model5<-lm_robust(norms_scale~tr_platform+tr_interview+wave, data=data_combined)
summary(model5)
model5_adj<-lm_robust(norms_scale~tr_platform+tr_interview+ wave+ factor(region) + factor(sex) + factor(education) + attitudes_pre_scale + age_num + factor(party), data=data_combined)
summary(model5_adj)

model6<-lm_robust(norms_scale~tr_platform*tr_interview+wave, data=data_combined)
summary(model6)
model6_adj<-lm_robust(norms_scale~tr_platform*tr_interview+ wave+ factor(region) + factor(sex) + factor(education) + attitudes_pre_scale + age_num + factor(party), data=data_combined)
summary(model6_adj)

model7<-lm_robust(norms_scale~factor(tr_cat)+tr_platform, data=uk)
summary(model7)
model7_adj<-lm_robust(norms_scale~factor(tr_cat)+tr_platform+ factor(region) + factor(sex) + factor(education) + attitudes_pre_scale + age_num + factor(party) + factor (brexit), data=uk)
summary(model7_adj)

model8<-lm_robust(norms_scale~factor(tr_cat)*tr_platform, data=uk)
summary(model8)
model8_adj<-lm_robust(norms_scale~factor(tr_cat)*tr_platform+ factor(region) + factor(sex) + factor(education) + attitudes_pre_scale + age_num + factor(party) + factor (brexit), data=uk)
summary(model8_adj)

texreg(list(model5, model5_adj, model6, model6_adj,model7, model7_adj, model8, model8_adj), include.ci = FALSE, stars=c(0.001, 0.01, 0.05), caption="Anti-Immigrant Norms")

###Table 4
model9<-lm_robust(radical_facts~factor(tr_cat) + tr_platform, data=uk)
summary(model9)
model9_adj<-lm_robust(radical_facts~factor(tr_cat) + tr_platform+ factor(region) + factor(sex) + factor(education) + attitudes_pre_scale + age_num + factor(party) + factor (brexit), data=uk)
summary(model9_adj)

model10<-lm_robust(accuracy~factor(tr_cat) + tr_platform, data=uk)
summary(model10)
model10_adj<-lm_robust(accuracy~factor(tr_cat) + tr_platform+ factor(region) + factor(sex) + factor(education) + attitudes_pre_scale + age_num + factor(party) + factor (brexit), data=uk)
summary(model10_adj)

texreg(list(model9, model9_adj, model10, model10_adj ), include.ci = FALSE, stars=c(0.001, 0.01, 0.05), caption="Mechanisms")
